<?php
/*

*/

/* session dans le template */
$template->assign_vars( array(
    'ID_OK'          => ((isset($_SESSION['IDENTIFICATION_OK']))?1:0),
    'ID_LOGIN'       => $LOGIN,
    'ID_NOM'         => $NOM,
    'ID_PRENOM'      => $PRENOM,
    'ID_IS_ADMIN'    => (($IS_ADMIN === true)?1:0),
    'ID_IS_UPLOADER' => (($IS_UPLOADER === true)?1:0)));

/* chaine des parametres get passé au script */
$template->assign_vars( array('GET_PARAMS' => str_replace('&', '&amp;', $_SERVER['QUERY_STRING'])));
$template->assign_vars( array('GET_CLEAN_PARAMS' => 'recherche='.$rechercheGet.'&amp;tags='.$listTagsGet.'&amp;types='.$listTypesGet.'&amp;tris='.$trisGet.''));

/* les différents parametres */
$template->assign_vars( array(
    'GET_PARAM_RECHERCHE' => $rechercheGet,
    'GET_PARAM_TYPE'      => $listTypesGet,
    'GET_PARAM_TAG'       => $listTagsGet,
    'GET_PARAM_TRIS'      => $trisGet));

/* option de configuration dans le template */
$template->assign_vars($arrayCONF);

/* page d'arrivée */
$referer = null;
if(isset($_SERVER['HTTP_REFERER']))
  {
    $template->assign_vars( array('REFERER' => $_SERVER['HTTP_REFERER']));
    $referer = $_SERVER['HTTP_REFERER'];
  }

/* temps de génération de la page */
$template->assign_vars( array('TEMPS_GENERATION' => round((getMicrotime() - $temps_generation_deb), 3)));

/* version */
$ligne = file('version');
$num_version  = trim($ligne[0]);
$nom_version  = trim($ligne[1]);
$code_version = trim($ligne[2]);

$template->assign_vars( array(
    'NUM_VERSION' => $num_version,
    'NOM_VERSION' => $nom_version));

/* langue du thème si pris en charge par le thème courrant */
if(file_exists($CONF['theme_dir'].'/langues.php'))
  {
    $langue = $CONF['langue'];
    include_once $CONF['theme_dir'].'/langues.php';
    $TL_parsed = array();
    if(is_array($TL))
      {
	foreach($TL as $clef => $value)
	  {
	    $TL_parsed['LANG_'.strtoupper($clef)] = $value;
	  }
	$template->assign_vars($TL_parsed);
      }
  }
  
if($PLUGIN_OK)
{
    if(!empty($PLUGINS['template']))
    {
        foreach($PLUGINS['template'] as $nom => $lePlugin)
        {
            $E = $lePlugin->action();
            //--- if(DEBUG && eregi('err',$E)) die($E);
        }
    }
}
?>
